<template>
    <div class="mv-detail">
      <div class="video">
        <video v-if='mvInfo.recommend_url' :src="mvInfo.recommend_url" controls="controls" autoplay="autoplay"></video>
        <video v-else-if="mvInfo.play_urls" :src="mvInfo.play_urls[0]" controls="controls" autoplay="autoplay"></video>
        <div class="video-info" v-if="mvInfo.mv_info">
          <span class="mv-name">{{mvInfo.mv_info.mv_name}}</span>
          <span class="mv-singer">{{mvInfo.mv_info.singers}}</span>
          <span class="mv-play">播放量:{{mvInfo.mv_info.play_str}}</span>
        </div>
      </div>
      <div class="other-mv">
          <div class="title">大部分人还爱看</div>
          <MvList :list="mvInfo.other_list"></MvList>
      </div>
      <div class="mv-info" v-if="mvInfo.mv_info">
        <div class="title">视频简介</div>
        <div>
          <span class="singer">{{mvInfo.mv_info.singers}}</span>
          <span class="time">发行时间:{{mvInfo.mv_info.pub_date}}</span>
        </div>
        <div class="desc" v-html="mvInfo.mv_info.mv_desc.replace(/\n/g,'<br/>')"></div>
      </div>
      <MvComment :mvComment="mvComment"></MvComment>
    </div>
</template>

<script>
    import {mapState} from 'vuex'
    import MvList from '@/components/MvList/MvList'
    import MvComment from '@/components/MvComment/MvComment'
    export default {
        name: "MvDetail",
        data(){
          return{
            // mvComment:{}
          }
        },
        computed:{
          ...mapState(['mvInfo','mvComment'])
        },
        components:{
          MvList,
          MvComment
        },
        mounted(){
          this.$store.dispatch('getMvInfo',this.$route.params.mid)
          this.$store.dispatch('getMvComment',{id:this.$route.params.mid,pagenum:0,pagesize:25})
        }
    }
</script>

<style scoped lang="less">
.mv-detail{
  background:linear-gradient(to bottom,#f2f2f2,#fafafa);
  .title{
    font-size:24px;
    line-height: 2;
  }
  .video{
    width: 100%;
    margin: 10px auto 30px;
    text-align: center;
    background-color: #333333;
    >video{
      width: 89%;
    }
    .video-info{
      width: 89%;
      margin: 10px auto;
      text-align: left;
      .mv-name{
        font-size: 24px;
        color: white;
        line-height: 2;
        &:after{
          content: '';
          display: inline-block;
          width: 10px;
          height: 2px;
          background-color: white;
          margin-bottom: 6px;
          margin-left: 8px;
          margin-right: 2px;
        }
      }
      .mv-singer{
        font-size: 24px;
        color: white;
        line-height: 2;
      }
      .mv-play{
        font-size: 14px;
        color: #999;
      }
    }
  }
  .other-mv{
    position: relative;
    margin: 0 auto;
    width: 1200px;
  }
  .mv-info{
    margin: 0 auto;
    width: 1200px;
    .singer{
      line-height: 2;
      font-size: 14px;
      margin-right: 10px;
    }
    .time{
      line-height: 2;
      font-size: 14px;
    }
    .desc{
      line-height: 2;
      font-size: 14px;
    }
  }
}
</style>
